import { createSlice } from "@reduxjs/toolkit";

const filterSlice = createSlice({
  name: "filter",
  initialState: null,
  reducers: {
    /**
     * Set the filter state to the given payload.
     * @param {object} state The current state of the filter.
     * @param {object} action The action to set the filter state.
     * @return {object} The new state of the filter.
     */
    setFilter(state, action) {
      return action.payload;
    },
  },
});

export const { setFilter } = filterSlice.actions;
export default filterSlice.reducer;
